Micron Document
baubs git

Node / mirrors / respira / commits / 705815a

Commit 705815a8fcdb1679a54adfe9f76e098f6b4e31d0


Parents : 757e0cd
Author : Jan-Henrik Bruhn <jan-henrik.bruhn@offis.de>
Date : 2025-12-27T11:59:42+01:00

fix: Provide initial value to useRef in usePrevious hook

TypeScript requires an initial value argument when calling useRef.
Changed useRef<T>() to useRef<T | undefined>(undefined) to fix
build error and properly type the ref for the first render.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Changes

1 files changed, 1 insertions(+), 1 deletions(-)


Diff

diff --git a/src/hooks/usePrevious.ts b/src/hooks/usePrevious.ts
index 26b8021..f081f95 100644
--- a/src/hooks/usePrevious.ts
+++ b/src/hooks/usePrevious.ts
@@ -15,7 +15,7 @@
import { useEffect, useRef } from "react";
export function usePrevious<T>(value: T): T | undefined {
- const ref = useRef<T>();
+ const ref = useRef<T | undefined>(undefined);
useEffect(() => {
ref.current = value;

Served by rngit 1.3.3 - Generated in 0.03s